Skip to content

[CI][ROCm] Check AMD monokernels stage by stage against float64 references - #63486

Draft
AndreasKaratzas wants to merge 14 commits into
vllm-project:mainfrom
AndreasKaratzas:akaratza_amd_monokernel_tests
Draft

AndreasKaratzas wants to merge 14 commits into
vllm-project:mainfrom
AndreasKaratzas:akaratza_amd_monokernel_tests

Conversation

@AndreasKaratzas

@AndreasKaratzas AndreasKaratzas commented Oct 24, 2026 •

Copy link
Copy Markdown
Member
  • monokernels.yaml: one test area for every AMD monokernel (DeepSeek-V4.1 on MI355 and MI300, DeepSeek-V4-Pro, MiniMax-M3, Kimi-K3), each with exactly two steps: a blocking Mono I/O step and an optional [Nightly] Mono E2E step, with curated source_file_dependencies; the existing steps move here from models_basic.yaml and kernels.yaml
  • mono_reference.py and test_mono_primitives.py: a shared float64 plain-torch reference and checks of every device primitive the kernels share (transcendentals, scaled MFMAs, MXFP8/MXFP4 codes and rounding)
  • Per-model I/O tests drive each fused stage on synthetic weights and compare it with the float64 reference; every tolerance is derived from the formats, roundings and accumulation involved, with the derivation next to the bound, and checked against injected bugs
  • Comparisons against vLLM's and AITER's own ops move to the nightly steps, which also run gsm8k on the real checkpoint with a post-eval check that the monokernel ran on every rank (final_rpc_checks, monokernel_checks.py); thresholds are 3 binomial standard errors below the mono-off accuracy
  • Each gsm8k config pins its checkpoint and draft model to the revision it was calibrated on, so CI caches one snapshot per model and a checkpoint update can't silently change results
  • DeepSeek-V4.1 mono tests move to tests/models/deepseek_v41/amd_specialized_decode/, next to Kimi-K3's and MiniMax-M3's
  • AGENTS.md: a PR adding an AMD monokernel adds these two steps (or extends the model's), asserts accuracy rather than which code path ran, derives its tolerances, and passes 10 times in a row before submission

Monokernels landed on AMD for DeepSeek-V4.1 (#60397, #61082, #62131, #60731), Kimi-K3 (#60683), MiniMax-M3 (#62712, #62994) and DeepSeek-V4-Pro (#61482). Their CI was spread over three test areas, missed files the kernels read, compared mostly against vLLM's stock path with tolerances measured from that comparison, and could not tell whether the monokernel ran at all. Checking each stage against a slow, exact reference found two kernel bugs, each fixed in its own PR. Both are merged:

The architectural side is discussed on the RFC, #60904. Related open PRs: #63398 replaces MiniMax-M3's MonoKernel with ATOM's full-layer implementation, and #60833 adds a Qwen3.8 mono decode; both would get their steps here.

Hardware. Blocking steps use synthetic weights. Measured on MI355X, each fully triggered run costs about 3.3 GPU-h (DeepSeek-V4.1 14 min on 4 GPUs, DeepSeek-V4-Pro 7.5 min on 8, MiniMax-M3 7 min on 4, Kimi-K3 7 min on 8). DeepSeek-V4-Pro and Kimi-K3 need a whole mi355_8, and none of the steps fit mi355_dpx. The gsm8k runs of the four DeepSeek/Kimi configs took 2.2-3.0 GPU-h each (about 10 GPU-h per night), plus the two MiniMax-M3 configs and the nightly parity tests. New checkpoint storage per HF cache:

Checkpoint Size Nightly device
moonshotai/Kimi-K3 1453.8 GiB mi355_8 (does not fit MI300X)
deepseek-ai/DeepSeek-V4-Pro 805 GiB mi355_8
deepseek-ai/DeepSeek-V4.1-Flash 475.3 GiB mi355_4
amd/MiniMax-M3-MXFP4 226.0 GiB mi355_4
Inferact/Kimi-K3-DSpark 6.7 GiB mi355_8
Inferact/MiniMax-M3-EAGLE3 6.1 GiB mi355_4

Validation. On 8x MI350X with the CI pins (AITER v0.1.26, FlyDSL 0.4.0), each MI355 Mono I/O step passed 10 times in a row, and each [Nightly] Mono E2E step passed once with every gsm8k config above its threshold. The MI300 steps have not run (no gfx942 here), so their derived bounds are unvalidated on hardware. Engine smokes no longer compare whole layers: each stage runs vLLM's own op on the kernels' inputs, routing and index top-k near-ties are forced identical, and every observed difference sits within one or two ulps of the derived budget. Along the way:

  • AITER's tuned FlyDSL bf16 GEMM rounds split-K partials to bf16 before summing (3-5 ulp gaps in Kimi-K3's stock linears); an AITER fix is being prepared, and the engine test models it meanwhile.
  • [Issue]: FlyDSL MoE stage-1 fused FP8 output uses a different MXFP8 scale rule than fused_dynamic_mx_quant_moe_sort ROCm/aiter#6548 (a coarser E8M0 scale rule in the fused FP8 MoE stage 1 at small token counts) shows up as a 1.6-1.9% gap at 3 rows; the DeepSeek-V4.1 smoke tiles vLLM's MoE call to avoid it.
  • Kimi-K3's K2 tests launched each new build without the ranks first compiling it, so a slow compile could outlast the kernel's 10 s wait; every rank now compiles and meets at a barrier first, as the engine does.
  • MiniMax-M3's earlier gsm8k spread did not reproduce in 24 new runs (SD 0.0066, below the binomial SE of 0.0093).

AI assistance (Claude Code) was used to draft this change. Every line was reviewed by the submitter.

Move the DeepSeek-V4.1 (gfx950 and gfx942), Kimi-K3 specialized decode
and MiniMax-M3 MonoKernel steps into .buildkite/test_areas/monokernels.yaml,
each with curated source_file_dependencies, and extend their tests:
DSpark draft layers, FULL CUDA graphs, step-width and short-context sweeps,
KV-record writes, index-source and engagement checks for DSv4.1; e2e
replay, multi-width and multi-step K1, hostile routing and per-layer checks
against vLLM for Kimi-K3; launch/epoch engagement, EAGLE3 aux states,
width sweeps and stock/mono transitions for MiniMax-M3. Add nightly
real-checkpoint gsm8k configs whose post-eval check proves the monokernel
ran, and an AGENTS.md rule requiring a group here for new AMD monokernels.

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Andreas Karatzas <akaratza@amd.com>
@mergify mergify Bot added ci/build kimi k3 minimax rocm Related to AMD ROCm agents Related to information for agents labels Oct 24, 2026
@github-project-automation github-project-automation Bot moved this to Todo in AMD Oct 24, 2026
@mergify

mergify Bot commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @AndreasKaratzas.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

AndreasKaratzas and others added 2 commits October 25, 2026 12:02
…el_tests

Signed-off-by: Andreas Karatzas <akaratza@amd.com>

# Conflicts:
#	.buildkite/test_areas/models_basic.yaml
…ences

Rework the monokernels test area so each AMD monokernel has exactly two
steps: a blocking Mono I/O step that checks every fused stage against a slow
plain-torch float64 reference (shared tests/models/mono_reference.py and
device-primitive conformance in test_mono_primitives.py), plus one engine
parity smoke, and a nightly Mono E2E step with real-checkpoint GSM8K and an
engagement check. Covers DeepSeek-V4.1 (gfx950 and gfx942), the new
DeepSeek-V4-Pro mono decode layer, Kimi-K3 and MiniMax-M3; consolidates the
GSM8K configs under configs/monokernels/ and updates the AGENTS.md rule.

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Andreas Karatzas <akaratza@amd.com>
…no gsm8k thresholds

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Andreas Karatzas <akaratza@amd.com>
AndreasKaratzas and others added 2 commits October 26, 2026 17:38
….1 mono tests

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Andreas Karatzas <akaratza@amd.com>
Conflict in models_basic.yaml: this branch moves the AMD monokernel steps to
monokernels.yaml, and main (vllm-project#61482) added a DeepSeek-V4-Pro mono decode
layer with its own steps there. Those move too, into a DeepSeek-V4-Pro group
in monokernels.yaml: host checks (test_dsv4_mono_decode.py, previously in
the Basic Models AMD mirror) on MI355 and main's 8-GPU numerics step under
its key, with curated source_file_dependencies.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Andreas Karatzas <AndreasKaratzas@users.noreply.github.com>
@mergify mergify Bot removed the needs-rebase label Oct 26, 2026
…el_tests

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Andreas Karatzas <akaratza@amd.com>
@AndreasKaratzas AndreasKaratzas changed the title [CI][ROCm] Add a monokernels test area with a group per AMD monokernel [CI][ROCm] Check AMD monokernels stage by stage against float64 references Oct 26, 2026
…rge)

Keep the DeepSeek-V4-Pro Mono I/O and Nightly E2E steps, which already run
test_dsv4_mono_decode.py, test_dsv4_mono_layers.py and test_dsv4_mono_numerics.py,
and fold the extra source_file_dependencies of vllm-project#61482's steps into the I/O step.

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Andreas Karatzas <akaratza@amd.com>
@mergify mergify Bot added deepseek Related to DeepSeek models DSv4.1 Related to DeepSeek-V4.1 models labels Oct 26, 2026
…evisions

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Andreas Karatzas <akaratza@amd.com>
@mergify

mergify Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @AndreasKaratzas.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

AndreasKaratzas and others added 2 commits October 27, 2026 08:07
…hmetic

Engine smokes compare each stage with vLLM's own op on the kernels' inputs,
force routing and index top-k near-ties identical, and bound the remaining
differences from formats and roundings. Instruction accuracies follow the
CDNA3/CDNA4 ISA. Kimi-K3's K2 tests compile on every rank before launching.

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Andreas Karatzas <akaratza@amd.com>
…el_tests

Conflicts: main reflowed the moved DSv4.1 gfx942 and models_basic commands;
keep the moves and take main's layout and its Kimi-K3 prefix-cache ignore.
Main now type-checks tests/models/kimi_k3 and minimax_m3: type the MiniMax
runner and metadata, and spell out a Kimi-K3 reference call.

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Andreas Karatzas <akaratza@amd.com>
@mergify mergify Bot removed the needs-rebase label Oct 29, 2026
The test sets VLLM_ROCM_USE_AITER after vllm._aiter_ops may already be
imported (the metadata import mypy needs loads it at collection), so the
in-process executor read stale gates and chose a FileStore that AITER's
custom all-reduce rejects. Refresh the gates after setting the env.

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Andreas Karatzas <akaratza@amd.com>
@mergify

mergify Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @AndreasKaratzas.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase label Oct 29, 2026
AndreasKaratzas and others added 2 commits October 30, 2026 04:35
…el_tests

Main's vllm-project#64101 adds DSv4.1 mono decode at TP8 with its own blocking step and
TP8 cases in the tests this branch moved; fold them into the moved tests and
run them in the DSv4.1 Mono I/O (now mi355_8) and Nightly steps. Main's
vllm-project#64008 launches the mono kernels through _run_compiled, so the numerics
test taps K1 there instead of wrapping the launcher.

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Andreas Karatzas <akaratza@amd.com>
…el_tests

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Andreas Karatzas <akaratza@amd.com>
@mergify

mergify Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @AndreasKaratzas.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase label Oct 31, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Related to information for agents ci/build deepseek Related to DeepSeek models DSv4.1 Related to DeepSeek-V4.1 models k3 kimi minimax needs-rebase rocm Related to AMD ROCm

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant